<template>
	<view class="">
		<view class="bj">
			<view class="topbox">
				<view class="leftbox">
					<view class="title">
						可提现佣金
					</view>
					<view class="price">
						{{obj.money}}
					</view>
				</view>
				<view class="shux">

				</view>
				<view class="rigbox">
					<view class="title">
						冻结佣金
					</view>
					<view class="price">
						{{obj.frozen}}
					</view>
				</view>
			</view>
			<view class="tx" @click="withdraw">
				立即提现
			</view>
		</view>
		<view class="hr">

		</view>
		<view class="btnbox">
			<u-tabs :list="tblist" bar-width="110" font-size="26" bg-color="#ffffff" active-color="#FF9933"
				:is-scroll="false" :current="current" @change="change"></u-tabs>
			<view class="listbox" v-for="(item,index) in list" :key="index">
				<view class="leftbox">
					<image :src="item.head_img" mode=""></image>
					<text>{{item.name}}</text>
				</view>
				<view class="rightbox">
					<view class="tc">提成：<text>{{item.getmoney_sum||0}}</text></view>
					<view class="tc">金币：<text>{{item.getgold_sum||0}}</text></view>
				</view>
			</view>

			<u-empty text="暂无记录" mode="list" v-if="list.length==0"></u-empty>
		</view>
	</view>
</template>

<script>
	import {getuserteam,
	getuserinfo} from "../../api/api/index.js"
	export default {
		data() {
			return {
				tblist: [{
					name: "直推"
				}, {
					name: "间推"
				}],
				current: 0,
				list:[],
				page:0,
				limit:20,
				flag:false,
				type:1,
				obj:{}
			}
		},
		methods: {
			change(index) {
				this.current = index;
				this.type = index + 1
				this.page=0
				this.flag=false
				this.list=[]
				this.public()
			},
			// 公共接口
			public(){
				if(this.flag){
					uni.showToast({
						title:"没有更多了",
						icon:"none",
						duration:2000
					})
				}
				this.page++
				let data={
					limit:this.limit,
					page:this.page,
					type:this.type
				}
				uni.showLoading({
					title:"加载中",
					mask:true
				})
				getuserteam(data).then(res=>{
					uni.hideLoading()
					this.list=this.list.concat(res.data)
					if(res.data.length<this.limit){
						this.flag=true
					}
				})
			},
			// 提现
			withdraw(){
				this.jumpLink({link:"/pagesB/txlist/index"})
			}
		},
		onShow() {
			this.page=0
			this.flag=false
			this.list=[]
			this.public()
			getuserinfo().then(res=>{
				console.log(res.data)
				this.obj=res.data
			})
		},
		onReachBottom() {
			this.public()
		}
	}
</script>

<style scoped lang="scss">
	.bj {
		width: 100%;
		height: 282rpx;
		background: url("http://youjialibo.wm76.mtnet.ren/upload/20210914/781e24eb91316edaa6d4e4af218a2033.png");
		background-size: 750rpx 282rpx;
		padding-top: 48rpx;
		box-sizing: border-box;

		.topbox {
			display: flex;
			justify-content: space-around;
			align-items: center;

			.title {
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
				text-align: center;
			}

			.price {
				font-size: 48rpx;
				font-family: PingFang SC;
				font-weight: 800;
				color: #FFFFFF;
				margin-top: 20rpx;
			}

			.shux {
				width: 1rpx;
				height: 105rpx;
				background: #FFFFFF;
				opacity: 0.32;
			}
		}

		.tx {
			margin: 20rpx auto;
			width: 180rpx;
			height: 65rpx;
			border-radius: 65rpx;
			text-align: center;
			line-height: 65rpx;
			background-color: #000000;
			color: #FFFFFF;
			font-size: 28rpx;
		}
	}

	.hr {
		height: 15rpx;
		background: #EDEDED;
		width: 100%;
	}
	.btnbox{
		position: fixed;
		top: 297rpx;
		right: 0;
		left: 0;
		bottom: 0;
		background-color: #FFFFFF;
		overflow: scroll;
		.listbox{
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 20rpx;
			box-sizing: border-box;
			border-bottom: 1rpx solid #EDEDED;
			margin-bottom: 60rpx;
			.leftbox{
				display: flex;
				align-items: center;
				image{
					width: 76rpx;
					height: 76rpx;
					border-radius: 76rpx;
				}
				text{
					font-size: 26rpx;
					font-family: Microsoft YaHei;
					font-weight: 400;
					color: #000000;
					margin-left: 20rpx;
				}
			}
			.rightbox{
				.tc{
					font-size: 24rpx;
					font-family: Microsoft YaHei;
					font-weight: 400;
					color: #999999;
					text{
						font-size: 30rpx;
						font-family: PingFang SC;
						font-weight: 800;
						color: #FF6600;
					}
				}
			}
		}
	}
</style>
